<?php

$xml=simplexml_load_file("menu.xml");
$data_array = array();
$i = 0;
foreach( $xml->children() as $category)
	{
		if($category->getname()=="category")
			{ 
				//echo "Category ->".$category."<br/>";
				foreach($category->children() as $suboritem)
				{
					if($suboritem->getname()=="category_sub")
					{	
						//echo "Sub Category ->".$suboritem."<br/>";
					
						foreach($suboritem->children() as $item)
						{
							$data_array[$i++] =  $item;
							//echo "Item ->".$item."<br/>";
							//.$item->attributes();
						}
					}
					else
					{
						$data_array[$i++] =  $suboritem;
						//echo "Item ->".$suboritem."<br/>";
						
					}					
				}
			}
		
	}
	
	

		
?>